package de.hmm.hwip.configuration.api;


/**
 *  Interface for complete System configuration service.
 * 
 * @author Johannes Mendel
 * @version 28.10.2012
 *
 */
public interface ISystemConf {
	/**
	 * function to get the query for getting all floors
	 * 
	 * @return query to get all data from floor table
	 */
	public String getQueryForFloors();
	
	/**
	 * function to get the query for getting all rooms
	 * 
	 * @return query to get all data from room table
	 */
	public String getQueryForRooms();
	
	/**
	 * function to get the query for getting all spots
	 * 
	 * @return query to get all data from spot table
	 */
	public String getQueryForSpots();
	
	/**
	 * function to get the query for getting all radiotypes
	 * 
	 * @return query to get all data from radiotype table
	 */
	public String getQueryForRadiotypes();
	
	/**
	 * function to get the query for getting all devices
	 * 
	 * @return query to get all data from device table
	 */
	public String getQueryForDevices();
	
	/**
	 * function to get the query for getting all system devices
	 * 
	 * @return query to get all data from sys_device table
	 */
	public String getQueryForSysDevices();
	
	/**
	 * function to get the query for getting all controlscripts
	 * 
	 * @return query to get all data from controlscript table
	 */
	public String getQueryForControlscripts();
	
	/**
	 * function to get the query for getting all linked device commands
	 * 
	 * @return query to get all data from link_device_command table
	 */
	public String getQueryForLinkDevCommands();
	
	/**
	 * function to get the query for getting all commands
	 * 
	 * @return query to get all data from command table
	 */
	public String getQueryForCommands();
	
	/**
	 * function to get the query for getting all connected devices
	 * 
	 * @return query to get all data from connected_devices table
	 */
	public String getQueryForConnectedDevices();
	
	/**
	 * function to get the query to get all rooms for given floor
	 * 
	 * @param floorId : foreign key from table floor
	 * @return query to get rooms for given floor
	 */
	public String getQueryForRoomsByFk(int floorId);
	
	/**
	 * function to get the query to get all spots for given room
	 * 
	 * @param room_id : foreign key from table room
	 * @return query to get spots for given room
	 */
	public String getQueryForSpotsByFk(int room_id);
	
	/**
	 * function to get the query to get all devices for given radiotype
	 * 
	 * @param rt_id : foreign key from table radiotype
	 * @return query to get devices for given radiotype
	 */
	public String getQueryForDevicesByFk(int rt_id);
	
	/**
	 * function to get the query to get all system devices for given device id
	 * 
	 * @param device_id : foreign key from table device
	 * @return query to get system devices for given device id
	 */
	public String getQueryForSysDevByDevFk(int device_id);
	
	/**
	 * function to get the query to get all system devices for given spot id
	 * 
	 * @param spot_id : foreign key from table spot
	 * @return query to get system devices for given spot id
	 */
	public String getQueryForSysDevBySpotFk(int spot_id);
	
	/**
	 * function to get the query to get all commands for given device id
	 * 
	 * @param device_id : foreign key from table device
	 * @return query to get commands for given device id
	 */
	public String getQueryForCommandByDevFk(int device_id);
	
	/**
	 * function to get the query to get all control scripts for given system device id
	 * 
	 * @param sys_dev_id : foreign key from table sys_device
	 * @return query to get control scripts for given sys_dev_id
	 */
	public String getQueryForControlBySysDevFk(int sys_dev_id);
	
	
	/**
	 * function to get the query for setting new floor
	 * 
	 * @param id : primary key
	 * @param floorNum : Floor number e.g. -2 for 2nd cellar
	 * @param description : description of the floor e.g. 1st Floor
	 * @return query to set floor data
	 */
	public String getQueryForSetFloor(int id, int floorNum, String description);

	/**
	 * function to get the query for setting new room
	 * 
	 * @param id : primary key
	 * @param floorId : foreign key from table Floor
	 * @param description : description of the room e.g. Office
	 * @return query to set room data
	 */
	public String getQueryForSetRoom(int id, int floorId, String description);
	
	/**
	 * function to get the query for setting new radio type
	 * 
	 * @param id : primary key
	 * @param name : name of the radio type e.g. Ant
	 * @return query to set radio type
	 */
	public String getQueryForSetRadioType(int id, String name);
	
	/**
	 * function to get the query for setting new device
	 * 
	 * @param id : primary key
	 * @param rt_id : foreign key from table radiotype
	 * @param model_type : type/name of device
	 * @param manufacture : manufacture of device
	 * @param specific : specification of device e.g Scale
	 * @param response : response for device if needed
	 * @param attr : attributes of device 
	 * @return query to set device
	 */
	public String getQueryForSetDevice(int id, int rt_id, String model_type, String manufacture, String specific, String response, String[] attr);
	
	/**
	 * function to get the query for linking a device with a command
	 * 
	 * @param dev_id : foreign key from device
	 * @param command_id : foreign key from command
	 * @return query to link device and command
	 */
	public String getQueryForSetLinkDevCom(int dev_id, int command_id);
	
	/**
	 * function to get the query for linling a system device with a controlscript
	 * 
	 * @param cs_id : foreign key from controlscript
	 * @param sys_dev : foreign key from sys_device
	 * @return query to link sys_device and controlscript
	 */
	public String getQueryForSetConnectDevices(int sys_dev, int cs_id);
	
	/**
	 * function to get the query for setting new command
	 * 
	 * @param id : primary key
	 * @param command : name of the command
	 * @param attr : attribute to control
	 * @param response : if command has to send a response
	 * @return query to set a new command
	 */
	public String getQueryForSetCommand(int id, String command, String attr, String response);
	
	/**
	 * function to get the query for setting control script
	 * 
	 * @param id : primary key
	 * @param command_id : foreign key of table command
	 * @param sys_dev_id : foreign key of table sys_device
	 * @param value : value to set for specified (by command) attribute
	 * @param cs_time : if there is a special time for command
	 * @param next_script : id of the following script (if there is one)
	 * @return query to set a new controlscript
	 */
	public String getQueryForSetControlscript(int id, int command_id, int sys_dev_id, String value, String cs_time, int next_script);
	
	/**
	 * function to get the query to update room data by roomId
	 * 
	 * @param roomId : Primary Key from table Floor
	 * @param floorId: foreign key of floor_id_fk
	 * @param description: description of the room
	 * @return query to update room data
	 */
	public String getQueryForUpdateRoom(int roomId, int floorId, String description);
	
	/**
	 * function to get the query to update a floors data
	 * 
	 * @param floorId : Primary Key from table Floor
	 * @param floorNum: number of floor
	 * @param description: description of the floor
	 * @return query to update floor data
	 */
	public String getQueryForUpdateFloor(int floorId, int floorNum, String description);
	
	/**
	 * function to get the query for updating radio type
	 * 
	 * @param id : primary key
	 * @param name : name of the radio type e.g. Ant
	 * @return query to update radio type
	 */
	public String getQueryForUpdateRadioType(int id, String name);
	
	/**
	 * function to get the query for updating device
	 * 
	 * @param id : primary key
	 * @param rt_id : foreign key from table radiotype
	 * @param model_type : type/name of device
	 * @param manufacture : manufacture of device
	 * @param specific : specification of device e.g Scale
	 * @param response : response for device if needed
	 * @param attr : attributes of device 
	 * @return query to update device
	 */
	public String getQueryForUpdateDevice(int id, int rt_id, String model_type, String manufacture, String specific, String response, String[] attr);
		
	/**
	 * function to get the query to update spot data
	 * 
	 * @param id : Primary Key from table Floor
	 * @param room_id :  foreign key from table room
	 * @param ip_address: ip address of the spot
	 * @return query to update spot data
	 */
	public String getQueryForUpdateSpot(int id, int room_id, String ip_address);
	
	/**
	 * function to get the query for updating a command
	 * 
	 * @param id : primary key
	 * @param command : name of the command
	 * @param attr : attribute to control
	 * @param response : if command has to send a response
	 * @return query to update a command
	 */
	public String getQueryForUpdateCommand(int id, String command, String attr, String response);
	
	/**
	 * function to get the query for updating a control script
	 * 
	 * @param id : primary key
	 * @param command_id : foreign key of table command
	 * @param sys_dev_id : foreign key of table sys_device
	 * @param value : value to set for specified (by command) attribute
	 * @param cs_time : if there is a special time for command
	 * @param next_script : id of the following script (if there is one)
	 * @return query to update a controlscript
	 */
	public String getQueryForUpdateControlscript(int id, int command_id, int sys_dev_id, String value, String cs_time, int next_script);
	
	/**
	 * function to get the query to delete floor by Id
	 * 
	 * @param floorId : Primary Key from table floor
	 * @return query to delete floor
	 */
	public String getQueryForDeleteFloor(int floorId);
	
	/**
	 * function to get the query to delete radio type by Id
	 * 
	 * @param rt_Id : Primary Key from table radiotype
	 * @return query to delete radiotype
	 */
	public String getQueryForDeleteRadiotype(int rt_Id);
	
	/**
	 * function to get the query to delete device by Id
	 * 
	 * @param dev_Id : Primary Key from table device
	 * @return query to delete device
	 */
	public String getQueryForDeleteDevice(int dev_Id);
	
	/**
	 * function to get the query to delete room by Id
	 * 
	 * @param roomId : Primary Key from table room
	 * @return query to delete room
	 */
	public String getQueryForDeleteRoom(int roomId);
	
	/**
	 * function to get the query to delete spot by Id
	 * 
	 * @param spot_id : Primary Key from table spot
	 * @return query to delete spot
	 */
	public String getQueryForDeleteSpot(int spot_id);
	
	/**
	 * function to get the query to delete command by Id
	 * 
	 * @param command_id : Primary Key from table command
	 * @return query to delete command
	 */
	public String getQueryForDeleteCommand(int command_id);
	
	/**
	 * function to get the query to delete system deive by Id
	 * 
	 * @param sys_dev_id : Primary Key from table sys_device
	 * @return query to delete sys_device
	 */
	public String getQueryForDeleteSysDevice(int sys_dev_id);
	
	/**
	 * function to get the query to delete control script by Id
	 * 
	 * @param cs_id : Primary Key from table controlscript
	 * @return query to delete controlscript
	 */
	public String getQueryForDeleteControlScript(int cs_id);
	
	/**
	 * function to get the query to delink connected devices
	 * 
	 * @param sys_dev_id : foreign Key from table system device
	 * @param cs_id : foreign key from table controlscript
	 * @return query to delete connected_devices
	 */
	public String getQueryForDeleteConnDevs(int sys_dev_id, int cs_id);
	
	/**
	 * function to get the query to delink linked devices with commands 
	 * 	  
	 * @param dev_id : foreign key from table device
	 * @param com_id : foreign key from table command
	 * @return query to delete link_device_command
	 */
	public String getQueryForDeleteLinkDevCom(int dev_id, int com_id);
}
